package xyz.chaobei.dockerdemo.controller;

import org.springframework.web.bind.annotation.*;
import xyz.chaobei.dockerdemo.model.OrgUser;

import java.util.LinkedList;
import java.util.List;

@RestController
@RequestMapping("/orgUser/")
public class OrgUserController {

    private static final List<OrgUser> free = new LinkedList<>();

    @GetMapping("/{id}")
    public OrgUser getOne(@PathVariable("id") Integer id) {
        return free.stream().filter(item -> item.getId().equals(id)).findFirst().orElse(new OrgUser());
    }

    @PostMapping("/")
    public Boolean save(@RequestBody OrgUser orgUser) {
        return free.add(orgUser);
    }


}